class User(object):
    def __init__(self, name):
        self.name = name


    def __str__(self):
        return 'my name is %s' %self.name


    def __add__(self, other):
        return self.name + other.name

    def __eq__(self, other):
        return self.name == other.name


tom = User('tom')
jerry = User('jerry')
# 魔法方法就是平时后面帮我调用了有一些双下划线的方法，我们自己也可以定义
print(tom)  # my name is tom
print(jerry)  # my name is jerry
print(tom == jerry)  # False
print(tom + jerry)  # tomjerry

